/**
 * Created by wujun on 2016/8/4
 */
angular.module('xyrhyddlr.service',[])
  .service('xyrhyddlrService',['appItfAopService','$ionicLoading','$timeout','ddcxService',function(appItfAopService,$ionicLoading,$timeout,ddcxService){

    var params={
      "IdCard":{},
      "packageChooseParams":[{"typeId":"01","typeName":"4M"},{"typeId":"02","typeName":"10M"},{"typeId":"03","typeName":"20M"},{"typeId":"04","typeName":"30M"},{"typeId":"05","typeName":"50M"}],
      "packageChooseName":"",

      "queryUserByPhone":{
        "UserNum":"",
        "_LOGIN_PARAM":""
      },

      "xhrhyddlrParams":{
        "psptId":"",
        "custName":"",
        "psptAddr":"",
        "contactPhone":"",
        "serialNumber":"",
        "serialNumberA":"",
        "productName":""
      },
      "queryUserByPhoneData":[],
      "queryUserByPhoneDataA":[]

    }

    return {
      getParams:function() {
        return params;
      },
      ReadIdCard :function(param){
        $ionicLoading.show({
        });
        bluetooth.sr_lydk(param,function(success){
            $ionicLoading.hide();
            $timeout(function(){
              params.IdCard=angular.fromJson(success);
              //alert(params.IdCard.address);
              //alert(params.IdCard.sex);
            },1000);
          },function(error){
            $ionicLoading.hide();
            var alertPopup=$ionicPopup.alert({
              title:'读取失败',
              template:angular.toJson(error),
              okText: '确定', // String (默认: 'OK')。OK按钮的文字。
              okType: 'item-customer-bg-darkred', // String (默认: 'button-positive')。OK按钮的类型。
            });
          }
        )
        return params.IdCard;
      },
      //手机号码查询用户名称
      validMobilePhone:function(params)
      {
        return appItfAopService.do_queryUserTransfer_req(params);
      },
      //校园融合预订单录入
      xyrhyddlrDateReturnOk:function(params)
      {
        return appItfAopService.do_xyrhyddlrDateReturnOk_req(params);
      },

    }
  }]);
